const db = uniCloud.database()
module.exports = {
	_before: function () { // 通用预处理器

	},
	getGoodsByCate(cate_id){
		return db.collection('goods').where({
			category_id:cate_id
		}).get()
	},
	// async 和 await
	async detail(id){
		let result = await db.collection("goods").limit(1).where({
			_id:id
		}).get()
		let ret = {
			affectedDocs:result.affectedDocs,
			data:result.data[0]
		}
		return ret
	}
}